home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / SCROLL.SWG / 0010_Multi-Line Scroll.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  1KB  |  46 lines

  1. {
  2. > Last month this routine for scrolling text across the screen was
  3. > posted in this echo.  It's a great routine but would the author of the
  4. > routine please describe how to place the scrolling text on any of the
  5. > 25 vertical lines, how to change the background color...the foreground
  6. > color I found. Also, can this routine place the text between two
  7. > points on the screen without writing over the extreme left and right
  8. > sides?
  9.  
  10. This should be what you're looking for.  I sort exapnded on the
  11. old code, but instead of using Mem for direct writes I set a
  12. screen structure over the text screen instead...makes it easier
  13. to understand.      }
  14.  
  15. PROGRAM NewScroll;
  16. Uses Crt;
  17.  
  18. TYPE
  19.   TCell = RECORD C: Char; A: Byte; END;
  20.   TScreen = array[1..25, 1..80] of TCell;
  21.  
  22. CONST
  23.   Row: byte = 15;
  24.   Col1: byte = 10;
  25.   Col2: byte = 70;
  26.   Attr: byte = $4F; { bwhite / red }
  27.   Txt: string = 'Hello world....         ';
  28.  
  29. VAR
  30.   Scr: TScreen ABSOLUTE $B800:0;
  31.   I, J: Byte;
  32. BEGIN
  33.   I := 1;
  34.   REPEAT
  35.     while (port[$3da] and 8) <> 0 do;  { wait retrace }
  36.     while (port[$3da] and 8) = 0 do;
  37.     FOR J := Col1 TO (Col2-1) DO
  38.       Scr[Row, J] := Scr[Row, J+1];  { shift cell left }
  39.     Scr[Row, Col2].C := Txt[I];      { add new cell }
  40.     Scr[Row, Col2].A := Attr;
  41.     I := 1 + (I MOD Length(Txt));
  42.   UNTIL Keypressed;
  43.  
  44. END.
  45.  
  46.